package tmts.commands;

import tmts.Server;

public class Start extends Command
{

    public Start(Server s)
    {
        super(s);
    }

    @Override
    public String getActionString()
    {
        return "start";
    }

    @Override
    public String execute(String[] command)
    {
        if (Server.raceRunning)
        {
            return "Race already started, please stop current race before starting another one";
        } else
        {
            if(command.length == 2)
            {
                int raceId = Integer.parseInt(command[1]);
                server.startRace(raceId);
                return "Race started";
            }
            else
            {
                return "Command not formed properly. correct format is 'start <raceId>'";
            }
        }
    }

}
